import { defineStore } from "pinia";
import { getMenuApi } from "@/https/aside";
import filterRoutes from "@/utils/filterRoutes";
import { asyncModulesList } from "@/router/index";
export const useAppStore = defineStore("app", {
  state() {
    return {
      isAddRoutes: false, // 是否添加过路由
    };
  },
  actions: {
    async getPermissionRoutes(val: string) {
      const res = await getMenuApi({ username: val });
      return filterRoutes(asyncModulesList, res.data.permissions);
    },
  },
});
